package com.example.work.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.work.entity.TbCheckAreaItem;
import com.example.work.entity.vo.ItemScoreVo;
import com.example.work.mapper.TbCheckAreaItemMapper;
import com.example.work.mapper.TbCheckAreaMapper;
import com.example.work.service.IAreaItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**

 */
@Service("areaItemService")
public class IAreaItemServiceImpl extends ServiceImpl<TbCheckAreaItemMapper, TbCheckAreaItem> implements IAreaItemService {

    @Autowired
    private TbCheckAreaItemMapper tbCheckAreaItemMapper;

    @Override
    public boolean updateAreaItemById(TbCheckAreaItem tbCheckAreaItem) {
         // 调用 BaseMapper 的 updateById 方法
        return this.updateById(tbCheckAreaItem);
    }

    /**
     * 根据区域的id获取其下的所有的项目
     * **/
    @Override
    public List<TbCheckAreaItem> getAreaItems(String areaId) {

        // 获取所有的区域项目
        List<TbCheckAreaItem> items = lambdaQuery().eq(TbCheckAreaItem::getAreaId, areaId).list();
        return items;
    }
}
